<?php 
	//$this->firephp->log($offers,'offers');
	//$this->firephp->log($classes,'classes');
	//$this->chromephp->log('offers: ',$offers);
	//$this->chromephp->log('classes: ', $classes);
	//$this->chromephp->log('school: ', $school);
?>



<div class="container">


	<!-- table with available offers -->
	<div class="row">
		<div class="span12">
			<h2><span>Lista de ofertas:</span></h2>
			
			<?php 
			
			if (isset($classes) && count($classes)!=0) {
				
				//$this->chromephp->log($classes);
				?>
				<table id="offerList" class="table table-condensed">
					<thead>
						<th>#</th>
						<th>oferta</th>
						<!-- <th>escola</th> -->
						<th>Preço</th>
						<th>nivel</th>
						<th>aulas</th>
						<th>vagas</th>
					</thead>
					
					<tbody>
					<?php 
					foreach ($classes as $value) {
						?>
							<tr>
								<?php if ($value->spots != 0) {?>
									<td><input id="#" class="offerInput" type="radio" checked="" value="" name="offerRadio"></td>
								<?php } else {?>	
								<td></td>
								<?php }?>
								<td>
									<?php 
										// link with information about the offer
										echo anchor(
											"Hotel/offer",
											$value->name,
											array(
												'class' 		=>'offerName',
												'data-offerId'	=>$value->offer_id,
												'data-classId'	=>$value->class_id,
												'data-userId'	=>$user->id,
												'data-price'	=>$value->price
											)
										);
									?>
								</td>
								<!-- <td> --><?php //echo $value->schoolName;?> <!-- </td> -->
								<td><?php echo $value->price;?></td>
								<td><?php echo $value->level;?></td>
								<td>
									<?php 
									// link number to show popup with available classes
										echo anchor(
											"Hotel/classes",
											//$value->futureClasses,
											$value->numberOfClasses,
											array(
												'class'			=>'classes',
												'data-offerId'	=>$value->offer_id,
												'data-classId'	=>$value->class_id,
												'data-userId'	=>$user->id
											)
										);
									?>
								</td>
								<td>
									<?php 
										echo $value->spots;
									?>
								</td>
							</tr>
						<?php 
						}
						?>
					</tbody>
				</table>
				<?php 
			}
			else {
				?><p><?php echo "Nao existem ofertas disponiveis!";?></p><?php 
			}
			?>
		</div>
	</div>
	
	<hr>
	
	<div class="row">
		<div class="span12">
		
			<h2><span>Opções:</span></h2>
			
			<!--  
			<div id="transportOption" class="">
				<label>Transporte:</label>
				<select>
					<option value="yes">sim</option>
					<option value="no">não</option>
				</select>
			</div>
			-->
			
			<div id="extrasList" class="control-group">
				
					<!--  <label class="control-label">Extras</label> -->
				
				
					<!--  
					<label class="checkbox">
						<input type="checkbox" value="" checked="" name="extrasList">
						extra 
					</label>
					-->
					
					<!--  
					<ul id="extrasList" class="formee-list listWithExtras">
						<li><input type="checkbox" /><label>extra 1 (10 €)</label></li>
						<li><input type="checkbox" /><label>extra 2 (5 €)</label></li>
						<li><input type="checkbox" /><label>extra 3 (2 €)</label></li>
					</ul>
				-->
			</div>
		</div>
	</div>
	
	<hr>
	
	<div class="row">
		<div class="span12">
			<h2><span>Escolher Cliente:</span></h2>
			<div class="module-body">
				<table id="clientTable" class="">
					<thead>
						<tr>
							<th>Nome</th>
							<th>Morada</th>
							<th>Mail</th>
							<th>Telefone</th>
							<th>Data Nascimento</th>
						</tr>
					</thead>
					<tbody></tbody>
				</table>	
			</div>
		</div>
	</div>
	
	
	
	
	<div class="row">
		<div class="span8">
		<br>
		<p>Total: </p><div id="totalCost" value="0">0 euros</div>
		<br>
		<button id="reserveButton" 	class="btn btn-primary">Reservar</button>
		<button id="deleteButton" 	class="btn btn-danger hidden">eliminar</button>
		<button id="refreshButton" 	class="btn btn-info hidden">refresh</button>
		<button id="tmpButton" 		class="btn btn-warning hidden">temp</button>
		</div>
	</div>
	
	<hr>
	
	<div class="row">
		<div class="span8">
		
			<h2><span>Dados do cliente:</span></h2>
			
			<?php 
				//$attr = array('class'=>'well form-inline');
				$attr = array('class'=>'form-horizontal', 'id'=>'clientForm');
				echo form_open('School/tmp',$attr);
			?>
			
			<div id="clientName" class="control-group">
				<label class="control-label">Nome: </label>
				<div class="controls">
					<input type="text" class="span4" name="name" placeholder="insira o nome . . . ">
					<span class="help-inline"></span>
				</div>
			</div>
			<div id="clientAddress" class="control-group">
				<label class="control-label">Endereço: </label>
				<div class="controls">
					<input type="text" class="span4" name="address" placeholder="insira o endereço . . .">
					<span class="help-inline"></span>
				</div>
			</div>
			<div id="clientEmail" class="control-group">
				<label class="control-label">email: </label>
				<div class="controls">
					<input type="text" class="span2" name="email" placeholder="insira o email . . .">
					<span class="help-inline"></span>
				</div>
			</div>
			<div id="clientPhone" class="control-group">
				<label class="control-label">telefone: </label>
				<div class="controls">
					<input type="text" class="span2" name="phone" placeholder="insira o telefone . . .">
					<span class="help-inline"></span>
				</div>
			</div>
			<div id="clientBirthday" class="control-group">
				<label class="control-label">Data Nascimento: </label>
				<div class="controls">
					<input type="text" class="span2" name="birthday" placeholder="data de nascimento ...">
					<span class="help-inline"></span>
				</div>
			</div>
			<div id="clientHeight" class="control-group">
				<label class="control-label">altura: </label>
				<div class="controls">
					<input type="text" class="span1" name="height" placeholder="altura(cm) ...">
					<span class="help-inline"></span>
				</div>
			</div>
			<div id="clientWeight" class="control-group">
				<label class="control-label">peso: </label>
				<div class="controls">
					<input type="text" class="span1" name="weight" placeholder="peso(kg) ...">
					<span class="help-inline"></span>
				</div>
			</div>
			<div id="clientSex" class="control-group success">
				<label class="control-label">sexo: </label>
				<div class="controls">
					<select class="span2" name="sex">
						<option value="m">masculino</option>
						<option value="f">feminino</option>
					</select>
				</div>
			</div>
			<div id="clientNationality" class="control-group">
				<label class="control-label">Nacionalidade</label>
				<div class="controls">
					<input type="text" class="span2" name="nationality" placeholder="nacionalidade ...">
					<span class="help-inline"></span>
				</div>
			</div>
			<div id="clientLanguages" class="control-group">
				<label class="control-label">Linguagens</label>
				<div class="controls" name="languages">
					<label class="checkbox">
						<input type="checkbox" value="pt" name="portuguese">
						Português
					</label>
					<label class="checkbox">
						<input type="checkbox" value="en" name="english">
						Inglês
					</label>
					<label class="checkbox">
						<input type="checkbox" value="es" name="spanish">
						Espanhol
					</label>
					<label class="checkbox">
						<input type="checkbox" value="fr" name="french">
						Espanhol
					</label>
					<label class="checkbox">
						<input type="checkbox" value="de" name="german">
						Alemão
					</label>
				</div>
			</div>
			<div id="clientInfo" class="control-group">
				<label class="control-label" >Observações</label>
				<div class="controls">
					<textarea class="input-xxlarge"	name="info" rows="8"></textarea>
					<span class="help-inline"></span>
				</div>
			</div>
			
			<!-- HIDDEN FIELDS -->
			<input type="hidden" id="clientId" 			name="clientId" 	value="0"/>
			<!--
			<input type="hidden" id="hidden01" 			name="hidden01" 	value="0"/>
			<input type="hidden" id="hidden02" 			name="hidden02" 	value="0"/>
			<input type="hidden" id="hidden03" 			name="hidden03" 	value="0"/>
			<input type="hidden" id="hidden04" 			name="hidden04" 	value="0"/>
			<input type="hidden" id="hidden05" 			name="hidden05" 	value="0"/>
			-->
			<!-- ************* -->
			
			<?php echo form_close();?>
			
			<button id="createButton" class="btn">Criar Cliente</button>
			<button id="clearButton"  class="btn">Limpar</button>
		</div> <!-- #span8 -->
	</div> <!-- #row -->
	
	<div class="row">
		<div class="span4 offset4">
		</div>
	</div>
	
	
	<div id="createClientAlert" class=""></div>
	
</div> <!-- #container -->








<!-- *** DIALOGS *** -->
<div id="infoDialog" 			title="info" 		class="dialog">info</div>
<div id="alertDialog" 			title="alert" 		class="dialog">alert</div>
<div id="errorDialog" 			title="error" 		class="dialog">error</div>

<div id="offerInfoDialog"		title="" 			class="dialog">
	<div class="infoLabel"><p>Preço:</p></div><div class="infoContent price"><p></p></div> 
	<div class="infoLabel"><p>Nível:</p></div><div class="infoContent level"><p></p></div>
	<div class="description"><p>Descrição</p></div>
</div>

<div id="popUpCalendarDialog"	title="calendario" 	class="dialog">
</div>

<div id="genericAlert"			title="" 					class="dialog"></div>
<div id="reservationOptions" 	title="Opcoes adicionais" 	class="dialog">
	<form id="formOptions" class="">
		<fieldset>
			<div class="">
				<label>Transporte</label>
				<select id="transportOption">
					<option value="yes">sim</option>
					<option value="no">não</option>
				</select>
			</div>
			<div class="control-group">
				
				<label class="control-label">Extras</label>
				<div class="controls" name="extras">
				
					<label class="checkbox">
						<input type="checkbox" value="pt" name="portuguese">
						extra 1
					</label>
					<label class="checkbox">
						<input type="checkbox" value="en" name="english">
						extra 2
					</label>
					<label class="checkbox">
						<input type="checkbox" value="es" name="spanish">
						extra 3
					</label>	
				<!--  
				<ul id="extrasList" class="formee-list listWithExtras">
					<li><input type="checkbox" /><label>extra 1 (10 €)</label></li>
					<li><input type="checkbox" /><label>extra 2 (5 €)</label></li>
					<li><input type="checkbox" /><label>extra 3 (2 €)</label></li>
				</ul>
				-->
				
				</div>
			</div>
		</fieldset>
	</form>
	<div id="confirmation" title="">
		<h3>Efectuar reserva?</h3>
	</div>
</div>
<!-- ******* -->






<!-- temp components -->
<!-- *************** -->









